Skip to main content

Robotiq::GripperModbusClient Class

Advanced, low-level access: one Modbus transaction per call.

warning

Use Gripper instead. This class is supported public API, but only because a few integrations genuinely cannot use Gripper — reach for it only when one of these describes you:

  • a single-threaded target (a microcontroller superloop) that schedules the exchange itself and has no Platform to run a thread on;
  • setup or diagnostic tooling that must issue one specific transaction and see it fail;
  • a deterministic test bench that drives the bus step by step.

Everything else — every application that controls a gripper — should use Gripper, whose setCommand()/getStatus() read and write a process image and never touch the bus. Driving this class from an application means every accessor becomes a blocking Modbus transaction on the caller's thread: the anti-pattern Gripper exists to prevent.

Calls are scoped to the two blocks documented in the gripper's instruction manual. The client owns the serial connection; it opens on construction and closes on destruction. Not thread-safe: one client, one thread.

Included Headers

#include <modbus_client.hpp>

Members

Public Constructors
GripperModbusClient (const ConnectionConfig &config, std::shared_ptr< Logger > logger=nullptr)

Open the built-in serial transport described by config. More...

GripperModbusClient (std::unique_ptr< Serial > serial, uint8_t slaveAddress, std::shared_ptr< Logger > logger=nullptr)

Drive a caller-supplied transport; opens it if needed. More...

GripperModbusClient (const GripperModbusClient &)=delete
Public Destructor
~GripperModbusClient ()

Closes the serial connection. More...

Public Operators
GripperModbusClient &operator= (const GripperModbusClient &)=delete
Public Member Functions
GripperStatusreadStatus ()

Read the status block (FC 0x03). More...

voidwriteCommand (const GripperCommand &command)

Write the command block (FC 0x10). More...

GripperStatusexchange (const GripperCommand &command)

Write the command block and read the status block in a single FC 0x17 transaction — the exchange step of a communication cycle. More...

Public Constructors

GripperModbusClient()

Robotiq::GripperModbusClient::GripperModbusClient(const ConnectionConfig &config,
std::shared_ptr< Logger >logger = nullptr
)
explicit

Open the built-in serial transport described by config.

Parameters
config

see ConnectionConfig.

logger

Log sink; pass null to use the default stderr logger.

Exceptions
<a href="/docs/drivers/2F hande/SDK/C++/API/classes/robotiq/serialioexception">SerialIOException</a>

when the port cannot be opened/configured.

GripperModbusClient()

Robotiq::GripperModbusClient::GripperModbusClient(std::unique_ptr< Serial >serial,
uint8_tslaveAddress,
std::shared_ptr< Logger >logger = nullptr
)

Drive a caller-supplied transport; opens it if needed.

Parameters
serial

The byte-level link to the gripper.

slaveAddress

The gripper's Modbus slave address.

logger

Log sink; pass null to use the default logger.

GripperModbusClient()

Robotiq::GripperModbusClient::GripperModbusClient(const GripperModbusClient &
)
delete

Public Destructor

~GripperModbusClient()

Robotiq::GripperModbusClient::~GripperModbusClient ()

Closes the serial connection.

Public Operators

operator=()

GripperModbusClient & Robotiq::GripperModbusClient::operator=(const GripperModbusClient &
)
delete

Public Member Functions

exchange()

GripperStatus Robotiq::GripperModbusClient::exchange(const GripperCommand &command
)

Write the command block and read the status block in a single FC 0x17 transaction — the exchange step of a communication cycle.

Parameters
command

The block to write.

Returns

The status block the gripper answered with.

Exceptions
<a href="/docs/drivers/2F hande/SDK/C++/API/classes/robotiq/driverexception">DriverException</a>

as for readStatus(); note that the exception can happen after the write has been applied.

readStatus()

GripperStatus Robotiq::GripperModbusClient::readStatus ()

Read the status block (FC 0x03).

Returns

The status block the gripper answered with.

Exceptions
<a href="/docs/drivers/2F hande/SDK/C++/API/classes/robotiq/driverexception">DriverException</a>

on any transaction failure — Modbus protocol errors (timeout, CRC, exception response) and wire-level failures alike.

writeCommand()

void Robotiq::GripperModbusClient::writeCommand(const GripperCommand &command
)

Write the command block (FC 0x10).

Parameters
command

The block to write.

Exceptions
<a href="/docs/drivers/2F hande/SDK/C++/API/classes/robotiq/driverexception">DriverException</a>

as for readStatus().


The documentation for this class was generated from the following file:

  • modbus_client.hpp

Generated via doxygen2docusaurus 2.2.2 by Doxygen 1.9.8.